Passed
Pull Request — master (#442)
by
unknown
06:24
created

Table.getColumnTexts   A

Complexity

Conditions 2

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
1
import { HtmlColumn } from './HtmlColumn';
2
3
type IColumn = string | HtmlColumn;
4
5
export interface ICell {
6
  name: string;
7
  renderHtml(): string;
8
  renderText(): string;
9
}
10
11
export type Row = ICell[];
12
13
export class Table {
14
  constructor(
15
    public readonly columns: IColumn[],
16
    public readonly rows: Row[]
17
  ) {}
18
19
  public getColumnTexts(): string[] {
20
    return this.columns.map(col =>
21
      col instanceof HtmlColumn ? col.text : col
22
    );
23
  }
24
}
25
26
export class Inline {
27
  constructor(public readonly columns: IColumn[], public readonly row: Row) {}
28
}
29